package com.dkakunsi.monev.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dkakunsi.monev.dao.IndikatorDao;
import com.dkakunsi.monev.entity.Indikator;
import com.dkakunsi.monev.entity.Kegiatan;
import com.dkakunsi.monev.util.MonevDataException;

@Service("indikatorService")
@Transactional(readOnly=true)
public class IndikatorService extends MonevAbstractService {
	@Autowired private IndikatorDao dao;
	
	@Transactional(readOnly=false)
	public void simpanIndikator(Indikator indikator) {
		dao.save(indikator);
	}
	
	@Transactional(readOnly=false)
	public void hapusIndikator(Indikator indikator) {
		indikator.setListRealisasiIndikator(null);
		dao.delete(indikator);
	}
	
	public List<Indikator> get(Kegiatan kegiatan) throws MonevDataException {
		return dao.get(kegiatan);
	}
}
